import axios from 'axios';

const API_URL = 'http://localhost:8000';

export const colorizeImage = async (imageUri: string, style: string = 'anime') => {
  const formData = new FormData();
  formData.append('file', {
    uri: imageUri,
    name: 'sketch.jpg',
    type: 'image/jpeg'
  } as any);
  formData.append('style', style);

  try {
    const response = await axios.post(`${API_URL}/colorize`, formData, {
      headers: {
        'Content-Type': 'multipart/form-data',
      },
    });
    return response.data;
  } catch (error) {
    console.error('Error colorizing image:', error);
    throw error;
  }
};

export const getColorizationStatus = async (jobId: string) => {
  try {
    const response = await axios.get(`${API_URL}/status/${jobId}`);
    return response.data;
  } catch (error) {
    console.error('Error getting status:', error);
    throw error;
  }
};
